package com.springmvc.controller;

import com.springmvc.annotation.RequestMapping;
import com.springmvc.annotation.RequestParam;
import com.springmvc.annotation.ResponseBody;
import com.springmvc.test.User;
import org.springframework.stereotype.Controller;

import java.util.HashMap;
import java.util.Map;

@Controller
public class HellController {


    @RequestMapping("/test.do")
    public String test(@RequestParam("id")String id){
        System.out.println(id);
        return "ok";
    }

    @RequestMapping("/map.do")
    @ResponseBody
    public Map<String,String> map(){
        Map<String,String> data = new HashMap<>();
        data.put("id", "11");
        data.put("name", "abc");
        data.put("age", "34");
        return data;
    }

    @RequestMapping("/user.do")
    @ResponseBody
    public User user(){
        User user = new User();
        user.setAge(23);
        user.setId("123");
        user.setName("bml");
        return user;
    }
}
